import Vue from "vue";
import VueRouter from "vue-router";
let Home = () => import('../views/Home.vue');
let Sort = () => import('../views/Sort.vue');
let Message = () => import('../views/Message.vue');
let Cart = () => import('../views/Cart.vue');
let Mine = () => import('../views/Mine.vue');
let Reg = () => import('../views/Reg.vue');
let Login = () => import('../views/Login.vue');
let List = () => import('../views/List.vue');
let Detail = () => import('../views/Detail.vue');

Vue.use(VueRouter);

const routes = [
  {
    path: "/home",      // 首页
    name: "Home",
    component: Home
  },
  {
    path: "/",
    redirect: "/home",  // 重定向
  },
  {
    path: "/sort",      // 分类
    name: "Sort",
    component: Sort
  },
  {
    path: "/message",   // 消息
    name: "Message",
    component: Message
  },
  {
    path: "/cart",      // 购物车
    name: "Cart",
    component: Cart
  },
  {
    path: "/mine",      // 我的
    name: "Mine",
    component: Mine
  },
  {
    path: "/reg",       // 登录
    name: "Reg",
    component: Reg
  },
  {
    path: "/login",     // 注册
    name: "Login",
    component: Login
  },
  {
    path: "/list",     // 列表页
    name: "List",
    component: List
  },
  {
    path: "/detail",     // 列表页
    name: "Detail",
    component: Detail
  },
];

const router = new VueRouter({
  routes
});

export default router;
